Readme for Replication of Did Private Election Administration Funding Advantage Democrats in 2020?

code/master.R provides an overview of all the code needed to reproduce every table and figure in the paper and appendix. Running this from beginning to end will result in all of the final output in paper and appendix. 

In order to replicate our analyses, you must first run code/install_packages.R. This script ensures you have the packages needed for this analysis. In some cases, we have forked R packages that are still under development and modified them to produce what we want. Our script code/install_packages.R handles this and provides the version of the package we used in the final version of our analyses.

Note that, for any of this code to run, you must declare your working directory at the top of every script.

If you would like to replicate only parts of the analysis, find below a list of all materials in the paper and appendix and the code required to produce them. In some cases, we have split estimation from the step of producing the table or figure. In those cases, you must run the estimation step prior to running the plot or table step.

We did not produce a table or figure with our counterfactual analysis, but we have listed it below.

Finally, at the bottom of this readme, we have included a list of the data files used in this replication archive.


Mapping between Code and Paper Output
-Fig 1: Map of Treatment
	-file: output/treatmap.pdf
	-plot-building code: code/tables_figures/make_maps.R

-Fig 2: Selection Binscatter (dem vs)
	-file: output/vs_selection.pdf
	-plot-building code: code/tables_figures/make_selection_plots.R

-Tab 1: Selection Regression Table
	-file: output/selection_table_alt.tex
	-table-building code: code/tables_figures/make_selection_tables.R

-Fig 3a: Trend Plot (dem vs)
	-file: output/trends_dem_vs.pdf
	-plot-building code: code/tables_figures/make_selection_plots.R

-Fig 3b: Trend Plot (turnout)
	-file: output/trends_turnout.pdf
	-plot-building code: code/tables_figures/make_selection_plots.R

-Fig 4a: Trend vs Counterfactual Plot (dem vs)
	-file: output/sdid_levels_demvs_figure.pdf
	-estimation code: code/estimation/00_estimation.R
	-plot-building code: code/tables_figures/make_main_effects_plots.R

-Fig 4b: Trend vs Counterfactual Plot (turnout)
	-file: output/sdid_levels_turnout_figure.pdf
	-estimation code: code/estimation/00_estimation.R
	-plot-building code: code/tables_figures/make_main_effects_plots.R

-Tab 2: Main Effects Table
	-file: output/main_effects_table.tex
	-estimation code: code/estimation/00_estimation.R
	-table-building code: code/tables_figures/make_main_effects_tables.R

-Counterfactual analysis
	-analysis code: code/counterfactual_exercise/counterfactual_exercise.R

-Fig S1: Policy Map
	-file: output/policy_map.pdf
	-plot-building code: code/tables_figures/make_maps.R

-Fig S2: Spending Bar Plot
	-file: output/spend_cats_wi.pdf
	-plot-building code: code/tables_figures/make_wi_spending_plot.R

-Fig S3: Covid Over Time
	-file: output/covid_cases_partisan.pdf
	-plot-building code: code/tables_figures/covid_by_2016.R

-Tab S1: Covid Selection Table
	-file: output/covid_selection_table.tex
	-table-building code: code/tables_figures/make_selection_tables.R

-Fig S4: Grant Receipt by State Bar Plot
	-file: output/treat_by_state.pdf
	-plot-building code: code/tables_figures/make_selection_plots.R

-Tab S2: Placebo Effect Table
	-file: output/placebo_2016_effects_table.tex
	-estimation code: code/estimation/01_estimation_pre_treat.R
	-table-building code: code/tables_figures/make_2016_placebo_effects_tables.R

-Fig S5a: Event Study Plot (dem vs)
	-file: output/sdid_only_event_study_demvs_figure.pdf
	-estimation code: code/estimation/00_estimation.R
	-plot-building code: code/tables_figures/make_main_effects_plots.R

-Fig S5b: Event Study Plot (turnout)
	-file: output/sdid_only_event_study_turnout_figure.pdf
	-estimation code: code/estimation/00_estimation.R
	-plot-building code: code/tables_figures/make_main_effects_plots.R

-Tab S3: Alternative Estimator Table (dem vs)
	-file: output/dem_effect_alt_est_table.tex
	-estimation code: code/estimation/01_robustness.R
	-table-building code: code/tables_figures/make_alt_estimator_tables.R

-Tab S4: Alternative Estimator Table (turnout)
	-file: output/turnout_effect_alt_est_table.tex
	-estimation code: code/estimation/01_robustness.R
	-table-building code: code/tables_figures/make_alt_estimator_tables.R

-Tab S5: Within-State Estimator Table
	-file: output/within_state_table.tex
	-table-building code: code/tables_figures/make_within_state_table.R

-Tab S6: Wisconsin Effect Table
	-file: output/wi_effects_table.tex
	-estimation code: code/estimation/01_wi_estimation.R
	-table-building code: code/tables_figures/make_wi_effects_tables.R

-Tab S7: Battleground Effect Table
	-file: output/battleground_effects_table.tex
	-estimation code: code/estimation/01_hetfx_sdid.R
	-table-building code: code/heterogeneity_tables_figures/make_battleground_effects_table.R

-Tab S8: Population Tercile Effect Table
	-file: output/vap_effects_table.tex
	-estimation code: code/estimation/01_hetfx_sdid.R
	-table-building code: code/heterogeneity_tables_figures/make_pop_tercile_effects_table.R

-Tab S9: Expenditure Tercile Effect Table
	-file: output/expterc_effects_table.tex
	-estimation code: code/estimation/01_hetfx_sdid.R
	-table-building code: code/heterogeneity_tables_figures/make_expenditure_tercile_effects_table.R

-Tab S10: Expenditure Tercile Entropy Balancing Effect Table
	-file: output/expterc_effects_table_ebal.tex
	-estimation code: code/estimation/01_hetfx.R
	-table-building code: code/heterogeneity_tables_figures/make_expenditure_tercile_effects_table_ebal.R


Data
-modified_data/ctcl.dta: This is the main analysis file used to produce many of the tables and figures.
-original_data/wi_grant_spend_totals.csv: This is a dataset breaking down how local governments in Wisconsin spent their CTCL grants. The Wisconsin Institute for Law and Liberty collected this data using many local public records requests.
-modified_data/wi_analysis_file.dta: This is the Wisconsin-specific analysis file.
-modified_data/wi_analysis_file_w_missing_pop.dta: This is an alternative Wisconsin analysis file that includes municipalities for which we do not have good population measures.
-modified_data/pres_results_for_counterfactual.dta: A file that contains the presidential election results for all counties (not just those in scope for our main analysis) so that we can conduct the counterfactual exercise.



